package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Position {
    private long poNo;
    private String poName;
    private String poDetail;
    private String poRespon;
    private List<User> users;

    @Id
    @Column(name = "PO_NO")
    public long getPoNo() {
        return poNo;
    }

    public void setPoNo(long poNo) {
        this.poNo = poNo;
    }

    @Basic
    @Column(name = "PO_NAME")
    public String getPoName() {
        return poName;
    }

    public void setPoName(String poName) {
        this.poName = poName;
    }

    @Basic
    @Column(name = "PO_DETAIL")
    public String getPoDetail() {
        return poDetail;
    }

    public void setPoDetail(String poDetail) {
        this.poDetail = poDetail;
    }

    @Basic
    @Column(name = "PO_RESPON")
    public String getPoRespon() {
        return poRespon;
    }

    public void setPoRespon(String poRespon) {
        this.poRespon = poRespon;
    }

    @OneToMany(mappedBy = "position")
    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Position position = (Position) o;
        return poNo == position.poNo &&
                Objects.equals(poName, position.poName) &&
                Objects.equals(poDetail, position.poDetail) &&
                Objects.equals(poRespon, position.poRespon);
    }

    @Override
    public int hashCode() {
        return Objects.hash(poNo, poName, poDetail, poRespon);
    }

    @Override
    public String toString() {
        return "Position{" +
                "poNo=" + poNo +
                ", poName='" + poName + '\'' +
                ", poDetail='" + poDetail + '\'' +
                ", poRespon='" + poRespon + '\'' +
                ", users=" + users +
                '}';
    }
}
